/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.base.service.book;

import java.util.List;

import com.thinkgem.jeesite.modules.base.entity.card.BaseCard;
import com.thinkgem.jeesite.modules.sys.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.base.entity.book.BaseBook;
import com.thinkgem.jeesite.modules.base.dao.book.BaseBookDao;

/**
 * 基础信息_书籍信息生成Service
 * @author 呆子
 * @version 2020-02-21
 */
@Service
@Transactional(readOnly = true)
public class BaseBookService extends CrudService<BaseBookDao, BaseBook> {

    @Autowired
    private BaseBookDao baseBookDao;

	public BaseBook get(String id) {
		return super.get(id);
	}

    public BaseBook findBookById(BaseBook baseBook) {
	    return baseBookDao.findBookById(baseBook);
    }

	public List<BaseBook> findList(BaseBook baseBook) {
		return super.findList(baseBook);
	}
	
	public Page<BaseBook> findPage(Page<BaseBook> page, BaseBook baseBook) {
		return super.findPage(page, baseBook);
	}

    public Page<BaseBook> findBook(Page<BaseBook> page, BaseBook baseBook) {
        // 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
        baseBook.getSqlMap().put("dsf", dataScopeFilter(baseBook.getCurrentUser(), "o", "a"));
        // 设置分页参数
        baseBook.setPage(page);
        // 执行分页查询
        page.setList(baseBookDao.findList(baseBook));
        return page;
    }
    public Page<BaseBook> selectBookPage(Page<BaseBook> page, BaseBook baseBook) {
        baseBook.setPage(page);
        page.setList(baseBookDao.selectBookNum(baseBook));
        return page;
    }
    public Page<BaseBook> indexFindBookPage(Page<BaseBook> page, BaseBook baseBook) {
        baseBook.setPage(page);
        page.setList(baseBookDao.selectBookNum(baseBook));
        return page;
    }
	@Transactional(readOnly = false)
	public void save(BaseBook baseBook) {
		super.save(baseBook);
	}
	
	@Transactional(readOnly = false)
	public void delete(BaseBook baseBook) {
		super.delete(baseBook);
	}
	
}